<template>
  <div class="card flex-col">
    <div class="card-title">
      {{ obj.tit }}
      <div>{{ obj.totalNum || 0 }}</div>
    </div>
    <div class="divAll">
      <div class="card-count tit1">
        {{ obj.tit1 }}
        <div class="proList">
          <p :style="`width:${percent(obj.day30)}%`" />
          <i>{{ percent(obj.day30) }}%</i>
        </div>
        <p>{{ obj.day30 }}</p>
      </div>
      <div class="card-count">
        {{ obj.tit2 }}
        <div class="proList">
          <p :style="`width:${percent(obj.day60)}%`" />
          <i>{{ percent(obj.day60) }}%</i>
        </div>
        <p>{{ obj.day60 }}</p>
      </div>
      <div class="card-count">
        {{ obj.tit3 }}
        <div class="proList">
          <p :style="`width:${percent(obj.day90)}%`" />
          <i>{{ percent(obj.day90) }}%</i>
        </div>
        <p>{{ obj.day90 }}</p>
      </div>
    </div>
    <div class="p1" @click="handleViewDetail">
      <p>查看详情 <i class="el-icon-arrow-right" /></p>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    obj: {
      type: Object,
    },
  },
  data() {
    return {};
  },
  methods: {
    percent(num) {
      if (!num) return 0;
      const percentage = (num / this.obj.totalNum) * 100;
      return percentage.toFixed(0);
    },
    handleViewDetail() {
      this.$emit("viewLeaseDetail");
    },
  },
};
</script>
<style lang="scss">
.card-table {
  & thead {
    color: #010101;
  }
}
</style>

<style lang="scss" scoped>
p {
  margin: 0;
  padding: 0;
}
i {
  font-style: normal;
}
.card {
  padding: 20px;
  border-radius: 4px;
  text-align: center;
  border: 1px solid rgba(221, 221, 221, 100);
  min-height: 250px;
}
.tit1 {
  padding-left: 5px;
}

.card-title {
  color: #414141;
  font-size: 16px;
  text-align: left;
  font-weight: bold;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.card-count {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}
.proList {
  flex: 0.8;
  background: #fff;
  border: 1px solid #ccc;
  height: 25px;
  line-height: 25px;
  position: relative;
  box-sizing: border-box;
}
.proList p {
  // position: absolute;
  // left: 0;
  // top: 0;
  height: 24px;
  background: #777575;
  box-sizing: border-box;
  float: left;
}
.proList i {
  float: left;
  margin-left: 4px;
}
.divAll {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 159px;
  padding-top: 40px;
}
::v-deep .proList .el-progress-bar__outer {
  border-radius: 0;
}
::v-deep .proList .el-progress-bar__inner {
  border-radius: 0;
}
.p1 {
  margin-top: 15px;
  text-align: right;
  color: #5ac6b7;
  font-size: 14px;
  p {
    display: inline-block;
    cursor: pointer;
  }
}
</style>
